package com.itheima.functinalInterface;

import org.junit.Test;

public class MyTest {
    
    public void demo(MyFunctionalInterface functionalInterface) {
        
        functionalInterface.exec();
    }
    
    @Test
    public void exec() {
        
        //jdk8之前
        demo(new MyFunctionalInterface() {
            @Override
            public void exec() {
                System.out.println("jdk8之前");
            }
        });
        // demo(new MyFunctionalInterface(){
        //
        //     @Override
        //     public void exec() {
        //         System.out.println("jdk8 before");
        //     }
        // });
        
        //jdk8 lambda
        demo(() -> System.out.println("jdk8之后"));
        // demo(()-> System.out.println("jdk8 later"));
        /*
         * Predicate 是否符合要求,过滤,输入,返回boolean
         * Consumer 消费,输入,无返回
         * Function  类型转换
         * Supplier 有返回,无输入
         * */
    }
}
